package com.example.myapplication2
import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.ViewModel


/***
 *    测试共享viewmodule
 * */
class ShareViewModlue :ViewModel() {


    private val shareData = MutableLiveData<MutableList<String>>()

    var mShareData = shareData


    fun getData():MutableLiveData<MutableList<String>>{
        return shareData
    }

    fun setData(){
        var mData = mutableListOf<String>()
        mData.add(0,"a")
        mData.add(1,"b")
        mData.add(2,"c")
        mData.add(3,"d")
        shareData.value = mData
    }

    fun addData(){
        var mData = mutableListOf<String>()
        mData.add(0,"a")
        mData.add(1, "b")
        mData.add(2, "a")
        shareData.value?.addAll(mData)
    }





}